//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

#ifndef SWITCH_H_
#define SWITCH_H_

#include <stdio.h>
#include <string.h>
#include <omnetpp.h>

#include "eth_pck_m.h"
#include "ageing_m.h"
#include "arp_m.h"

#define NUM_OF_GATES 4

using namespace std;

class Switch : public cSimpleModule
{
    private:
        string switchMAC;
        string filteringDatabase[NUM_OF_GATES];
        int agingTime;

        //enums
        int IPv4_type;
        int ARP_type;
        int ARP_request;
        int ARP_reply;

    protected:
        virtual void initialize();
        virtual void handleMessage(cMessage *msg);
        virtual void handleEthMessage(Eth_pck *msg, int gateIndex);
        virtual void handleAgeingMessage(Ageing *msg);
        virtual void forwardMessage(Eth_pck *msg, int gateIndex);
        virtual void broadcastMessage(Eth_pck *msg, int gateIndex);
        virtual int  macEntry(string address);
};

#endif /* SWITCH_H_ */
